package co.com.travelsoft.ati.client;


import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.ui.RootPanel;

public class HistoryListener implements ValueChangeHandler<String> {

	@Override
	public void onValueChange(ValueChangeEvent<String> event) {
		System.out.println("Current State : " + event.getValue());
		
		if (event.getValue().equals("login")){
    		RootPanel.get().clear();
    		RootPanel.get().add(new Login());
		}else if (event.getValue().equals("inicio")){
    		RootPanel.get().clear();
    		RootPanel.get().add(new Inicio());
    		MenuEP menu = new MenuEP();
    		menu.onModuleLoad();
    		RootPanel.get().add(menu.getMenu());
		}else if (event.getValue().equals("registrarUsuario")){
    		RootPanel.get().clear();
    		RootPanel.get().add(new FormularioRegistroUsuario());
		}else if (event.getValue().equals("registrarItinerarios")){
    		RootPanel.get().clear();
    		MenuEP menu = new MenuEP();
    		menu.onModuleLoad();
    		RootPanel.get().add(menu.getMenu());
    		RootPanel.get().add(new FormularioRegistroItinerarios());
		}else if (event.getValue().equals("consultarItinerarios")){
    		RootPanel.get().clear();
    		MenuEP menu = new MenuEP();
    		menu.onModuleLoad();
    		RootPanel.get().add(menu.getMenu());
    		MapaEventos mapa = new MapaEventos();
    		mapa.onModuleLoad();
    		RootPanel.get().add(mapa.getDock());
		}

	}

}
